#include <iostream>
#include <set>
using namespace std;
#define gua(i,a,b) for(int i=(a);i<=(b);++i) 
set<int>q;
int n,ans,k;
int main(){
	cin>>n;
	gua(i,1,n){
		int x;cin>>x;
		q.insert(x);
	}
	cin>>k;
	set<int>::iterator it1=q.begin();
	set<int>::iterator it2=q.end();--it2;
	while(*it1<*it2){
		if(*it1+*it2==k)++ans,++it1,--it2;
		else if(*it1+*it2<k)++it1;
		else --it2;
	}
	cout<<ans<<endl;
	return 0;
}
